package com.shhm.business.controller.business;

import com.shhm.business.dto.request.FilterProductReq;
import com.shhm.business.service.business.BusinessHomeService;
import com.shhm.common.dto.response.AjaxResultPlus;
import com.shhm.common.entity.admin.StudentEntity;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @author JackZ
 * @version 1.0
 * @description: TODO
 * @date 2025/9/10 下午12:36
 */
@RestController
@RequestMapping("/home")
public class BusinessHomeController {
    @Resource
    private BusinessHomeService businessHomeService;

    @GetMapping("/overview")
    public AjaxResultPlus getHomeOverview(){
        return businessHomeService.getHomeOverview();
    }

    @GetMapping("/product")
    public AjaxResultPlus productList(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "6") Integer pageSize
    ) {
        return businessHomeService.homeProductList(pageNum, pageSize);
    }

    @PostMapping("/product/filter")
    public AjaxResultPlus productTypeList(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "6") Integer pageSize,
            @RequestBody FilterProductReq entity
    ) {
        return businessHomeService.productTypeList(pageNum, pageSize, entity);
    }
    
    @PostMapping("/application/student")
    public AjaxResultPlus applicantStudent(@RequestBody StudentEntity entity){
        return businessHomeService.applicationStudent(entity);
    }
}
